package com.example.service.impl.shangPinServiceImpl;

import com.example.dao.shangPinDao.JournalDao;
import com.example.pojo.shangPinPojo.Journal;
import com.example.service.shangPinService.JournalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
@Service
public class JournalServiceImpl implements JournalService {
    @Autowired
    private JournalDao journalDao;
    /**
     * @Author: 郭
     * @Date: 2022/12/6 11:55
     * @Param:
     * @Return: List<Journal>
     * 商品日志表中的全查数据
     */
    @Override
    public List<Journal> getAll() {
        return journalDao.getAll();
    }
    /**
     * @Author: 郭
     * @Date: 2022/12/6 11:55
     * @Param:
     * @Return: int
     * 商品表中的总数据
     */
    @Override
    public int getCount() {
        return journalDao.getCount();
    }
    /**
     * @Author: 郭
     * @Date: 2022/12/15 10:51
     * @Param: journal
     * @Return: int
     * 添加的时候加一条日志
     */
    @Override
    public int insertLog(Journal journal) {
        journal.setJournalDate(new Date());
        return journalDao.insertLog(journal);
    }
    /**
     * @Author: 郭
     * @Date: 2022/12/15 18:27
     * @Param: journal
     * @Return: int
     * 修改商品信息的时候日志跟着改
     */
    @Override
    public int updateLog(Journal journal) {
        return journalDao.updateLog(journal);
    }
}
